package com.gsnd.gsnd21study.exception;

import com.gsnd.gsnd21study.utils.ResultCode;
import com.sun.org.apache.regexp.internal.RE;
import lombok.Getter;
import lombok.Setter;

/**
 * 自定义异常类
 */
@Getter
@Setter
public class ServiceException extends Exception{
    // 维护一个ResultCode对象
    private ResultCode resultCode;

    // 1、单参String的构造器
    public ServiceException(String msg){
        super(msg);
    }
    // 2、提供成员变量的构造器
    public ServiceException(ResultCode resultCode){
        super(resultCode.getCode()+" - "+resultCode.getMsg());
        this.resultCode = resultCode;
    }
}
